﻿using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
namespace INTEX.DataBase.Tools
{
    public partial class INTEXDBC
    {
        public void MapKDSTAMM(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveKDSTAMM(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            Result = QueryKDSTAMM(dwData);
            if (Result.Tables.Count > 0)
            {
                tbLocal = Result.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }

            MapKDSTAMM(ref dwLocal, dwData);

            if (!flgExist)
            {
                InsertKDSTAMM(dwLocal);
            }
            UpdateKDSTAMM(dwLocal);

        }
        public void InsertKDSTAMM(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            or1 = OracleDB.CreateCommand();
            DataSet result = new DataSet();
            switch (ITXDBVERSION)
            {
                case "50.24":
                    or1.CommandText = "INSERT INTO KDSTAMM(KDMANDANT, KDKUNDNR, KDKUNDNA, KDLAND, KDPLZ, KDORT, KDBZ, KDBZBEZ, KDSTAKZ, KDSTADAT, KDABCKL, KDANREDE, KDNAME1, KDKNAME, KDNAME2, KDSTRASSE1, KDSTRASSE2, KDPLZPOSTF, KDPOSTFACH, KDTEL, KDTELEX, KDFAX, KDBTX, KDDATEX, KDMBOX, KDMAILADR, KDTTEX, KDCOUNTY, KDCITY, KDZENTR, KDZENTRR, KDSPRKZ, KDBBN, KDSONDSTA, KDKDNRALT, KDLO, KDLB, KDLP, KDLIEFNR, KDINVDAT, KDDEBNR, KDKREDNR, KDUEBKZ, KDAUSK, KDAUSKKZ, KDMAHNST, KDMAHNH, KDGRPCUNO, KDCLEARCUNO, KDBIC1, KDIBAN1, KDBIC2, KDIBAN2, KDKREDLIM1, KDKREDVON1, KDKREDBIS1, KDKREDNLDAT1, KDVERS1, KDVERS21, KDKREDSB1, KDVERSTAGE1, KDVERSNR1, KDKREDLIM2, KDKREDVON2, KDKREDBIS2, KDKREDNLDAT2, KDVERS2, KDVERS22, KDKREDSB2, KDVERSTAGE2, KDVERSNR2, KDKREDLIM3, KDKREDVON3, KDKREDBIS3, KDKREDNLDAT3, KDVERS3, KDVERS23, KDKREDSB3, KDVERSTAGE3, KDVERSNR3, KDKREDLIM4, KDKREDVON4, KDKREDBIS4, KDKREDNLDAT4, KDVERS4, KDVERS24, KDKREDSB4, KDVERSTAGE4, KDVERSNR4, KDKREDLIM5, KDKREDVON5, KDKREDBIS5, KDKREDNLDAT5, KDVERS5, KDVERS25, KDKREDSB5, KDVERSTAGE5, KDVERSNR5, KDKREDEHA, KDKREDEHAR, KDKREDNOLI, KDKREDNOLIV, KDKREDNOLIB, KDAUFBESTTO, KDVERSUMLTO, KDOPSALDOTO, KDZUSKRED, KDZKREVON, KDZKREBIS, KDZKREDSB, KDOPSALDO, KDWEOBLIGO, KDVERSUML, KDSPERRKZ, KDSPERRGRD, KDLAUFDAT, KDBUCHHDAT, KDBRANCHE, KDFAKTART, KDKORT, KDLIMITKZ, KDSPLIEFKZ, KDAUFBEST, KDAUFBESTU, KDPREISPRF, KDMATPRF, KDBRTPRF, KDGQMPRF, KDSTKGPRF, KDSCHLIPRF, KDSCHLIABW, KDDRPAR, KDMWSTID, KDMWSTID2, KDLBMUSTR, KDFBMUSTR, KDSTLAND, KDSTREGBZ, KDSTKREIS, KDSTORT, KDLSART, KDREGMWST, KDMUSTERKZ, KDUMSVVJH, KDUMSVJH, KDUMSLJH, KDPRFZEUG, KDKONZMIT, KDRAITING, KDRECHWERT1, KDRECHWERT2, KDRECHWERT3, KDRECHWERT4, KDRECHWERT5, KDKREDKDNR, KDKOND, KDKDARTBEZ, KDKFIBUDAT, KDKFIBUZEIT, KDILN, KDDEBNRLAE, KDFACLIMIT, KDSHIPINVD, KDAUFBUTO, KDMAXBST, KDGRUPPE, KDEORI, KDEORINL, KDNTSCV, KDNTSCE, KDFILLER, KDAENZL, KDAENB, KDAEND, KDNEUB, KDNEUD)"
                                + " VALUES ((:KDMANDANT, :KDKUNDNR, :KDKUNDNA,  'CN ', '42116       ', 'ZHANGJIAGANG                            ', '1 ', 'JIANGSU      ', 'A', 20100603, 'C', '1', 'ó￠ì??1￡¨?D1ú￡?1??ê1???                  ', 'intex-j        ', 'intex (china) consulting Ltd.           ', '???ò??1úì?±±?·1o?                       ', '                                        ', '            ', '               ', '0512-58187818       ', '                    ', '                    ', '                    ', '                    ', '                                        ', '                                                                                                    ', '                    ', '    ', '    ', '        ', ' ', 'V', 'A                   ', ' ', '          ', '  ', '  ', '        ', '                ', 0, '00270070', '00000000', 'N', 0, '  ', ' ', '00000', '270070  ', '        ', '           ', '                                  ', '           ', '                                  ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, '  ', '  ', 0, 0, 50000, 0, 0, 0, 0, 0, '        ', 0, 0, 0, 'N', '   ', 20100603, 0, '   ', '   ', 'ZHANGJIAGA', 'N', ' ', 50000, 0, 'J', 'J', 'J', 'J', 'J', 'J', 'J', '     ', '                    ', '                    ', '   ', '   ', '  ', '  ', '  ', '   ', '   ', '   ', ' ', '00000000000', '00001500000', '00000000000', ' ', 'N', '   ', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '00270070', 'K', 'K', 0, 0, '             ', '0', 0, '000', 0, '00000', ' ', '                 ', '0000', ' ', ' ', '                                                                       ', 6, 'JAKV    ', 20111102, 'JAKV    ', 20100603)";
                    break;
                case "50.25":
                default:
                    or1.CommandText = "INSERT INTO KDSTAMM(KDMANDANT, KDKUNDNR, KDKUNDNA, KDLAND, KDPLZ, KDORT, KDBZ, KDBZBEZ, KDSTAKZ, KDSTADAT, KDABCKL, KDANREDE, KDNAME1, KDKNAME, KDNAME2, KDSTRASSE1, KDSTRASSE2, KDPLZPOSTF, KDPOSTFACH, KDTEL, KDTELEX, KDFAX, KDBTX, KDDATEX, KDMBOX, KDMAILADR, KDTTEX, KDCOUNTY, KDCITY, KDZENTR, KDZENTRR, KDSPRKZ, KDBBN, KDSONDSTA, KDKDNRALT, KDLO, KDLB, KDLP, KDLIEFNR, KDINVDAT, KDDEBNR, KDKREDNR, KDUEBKZ, KDAUSK, KDAUSKKZ, KDMAHNST, KDMAHNH, KDGRPCUNO, KDCLEARCUNO, KDBIC1, KDIBAN1, KDBIC2, KDIBAN2, KDKREDLIM1, KDKREDVON1, KDKREDBIS1, KDKREDNLDAT1, KDVERS1, KDVERS21, KDKREDSB1, KDVERSTAGE1, KDVERSNR1, KDKREDLIM2, KDKREDVON2, KDKREDBIS2, KDKREDNLDAT2, KDVERS2, KDVERS22, KDKREDSB2, KDVERSTAGE2, KDVERSNR2, KDKREDLIM3, KDKREDVON3, KDKREDBIS3, KDKREDNLDAT3, KDVERS3, KDVERS23, KDKREDSB3, KDVERSTAGE3, KDVERSNR3, KDKREDLIM4, KDKREDVON4, KDKREDBIS4, KDKREDNLDAT4, KDVERS4, KDVERS24, KDKREDSB4, KDVERSTAGE4, KDVERSNR4, KDKREDLIM5, KDKREDVON5, KDKREDBIS5, KDKREDNLDAT5, KDVERS5, KDVERS25, KDKREDSB5, KDVERSTAGE5, KDVERSNR5, KDKREDEHA, KDKREDEHAR, KDKREDNOLI, KDKREDNOLIV, KDKREDNOLIB, KDAUFBESTTO, KDVERSUMLTO, KDOPSALDOTO, KDZUSKRED, KDZKREVON, KDZKREBIS, KDZKREDSB, KDOPSALDO, KDWEOBLIGO, KDVERSUML, KDSPERRKZ, KDSPERRGRD, KDLAUFDAT, KDBUCHHDAT, KDBRANCHE, KDFAKTART, KDKORT, KDLIMITKZ, KDSPLIEFKZ, KDAUFBEST, KDAUFBESTU, KDPREISPRF, KDMATPRF, KDBRTPRF, KDGQMPRF, KDSTKGPRF, KDSCHLIPRF, KDSCHLIABW, KDDRPAR, KDMWSTID, KDMWSTID2, KDLBMUSTR, KDFBMUSTR, KDSTLAND, KDSTREGBZ, KDSTKREIS, KDSTORT, KDLSART, KDREGMWST, KDMUSTERKZ, KDUMSVVJH, KDUMSVJH, KDUMSLJH, KDPRFZEUG, KDKONZMIT, KDRAITING, KDRECHWERT1, KDRECHWERT2, KDRECHWERT3, KDRECHWERT4, KDRECHWERT5, KDKREDKDNR, KDKOND, KDKDARTBEZ, KDKFIBUDAT, KDKFIBUZEIT, KDILN, KDDEBNRLAE, KDFACLIMIT, KDSHIPINVD, KDAUFBUTO, KDMAXBST, KDGRUPPE, KDEORI, KDEORINL, KDNTSCV, KDNTSCE, KDKEYAC, KDKTOGRP, KDFILLER, KDAENZL, KDAENB, KDAEND, KDNEUB, KDNEUD)"
                                                    + " VALUES (:KDMANDANT, :KDKUNDNR, :KDKUNDNA, 'CN ', '            ', 'FOSHAN                                  ', '  ', '             ', 'A', 20130219, 'A', '1', 'NAME1                                   ', 'HLT            ', 'NAME2                                   ', 'STREET                                  ', 'ADDRESS                                 ', '            ', '               ', '0757-86880599       ', '                    ', '0757-86845974       ', '                    ', '                    ', '                                        ', 'kent@carpediem.hk                                                                                   ', '                    ', '    ', '    ', '00000000', 'J', 'E', 'A                   ', ' ', '          ', '  ', '  ', '        ', '                ', 0, '00000200', '00000200', 'N', 0, '  ', ' ', '00000', '200     ', '        ', '           ', '                                  ', '           ', '                                  ', 90000000, 0, 20231212, 0, '01', '  ', 'SUNLV   ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, 0, 0, 0, '  ', '  ', '        ', 0, '          ', 0, '  ', '  ', 0, 0, 4792400, 471548, 0, 200000, 20120312, 20220512, 'SUNLV   ', 0, 0, 471412, 'N', '   ', 20130105, 0, 'MIL', '   ', 'FOSHAN    ', 'F', 'N', 4567550, 0, 'J', 'J', 'J', 'J', 'J', 'J', 'J', '     ', '                    ', '                    ', '   ', '   ', '  ', '  ', '  ', '   ', '   ', '17%', ' ', '00000000000', '00009037120', '00002699800', ' ', 'N', '003', '0000000000', '0000000000', '0000000000', '0000000000', '0000000000', '00000200', 'K', 'K', 0, 0, '             ', '0', 0, '000', 0, '00000', ' ', '                 ', '0000', ' ', ' ', '        ', '  ', '                                                             ', 421, 'SUNLV   ', 20130219, 'WI      ', 19980128)";
                    break;
            }
            or1.Parameters.Add("KDMANDANT", OracleType.NVarChar).Value = dwData["KDMANDANT"].ToString();
            or1.Parameters.Add("KDKUNDNR", OracleType.NVarChar).Value = dwData["KDKUNDNR"].ToString();
            or1.Parameters.Add("KDKUNDNA", OracleType.NVarChar).Value = dwData["KDKUNDNA"].ToString();
            Connect2Proxy(or1);
        }
        public DataSet QueryKDSTAMM(DataRow dwData, int option = 1)
        {
            DataSet Return = new DataSet();
            DataTable tbLocal = null;
            DataSet Result = new DataSet();
            string table = "KDSTAMM";
             
                or1 = OracleDB.CreateCommand();
                switch (option)
                {
                    case 0:
                        or1.CommandText = "SELECT * FROM KDSTAMM WHERE  ROWNUM<2 ";
                        break;
                    case 1:
                        or1.CommandText = "SELECT * FROM KDSTAMM WHERE  "
                            + "  KDMANDANT=:KDMANDANT AND KDKUNDNR=:KDKUNDNR";
                        or1.Parameters.Add("KDMANDANT", OracleType.NVarChar).Value = dwData["KDMANDANT"].ToString();
                        or1.Parameters.Add("KDKUNDNR", OracleType.NVarChar).Value = dwData["KDKUNDNR"].ToString();
                        break;
                    case 2:
                        or1.CommandText = "SELECT KDMANDANT,KDKUNDNR,KDKUNDNA,KDNAME1, KDSTRASSE1,KDKNAME,KDTEL,KDTELEX,KDFAX"
                        + " FROM KDSTAMM WHERE KDMANDANT=:KDMANDANT ORDER BY KDKUNDNA";
                        or1.Parameters.Add("KDMANDANT", OracleType.NVarChar).Value = dwData["KDMANDANT"].ToString();
                        break;
                    case 3:
                        or1.CommandText = "SELECT DISTINCT VVLIEFSCH,P.* FROM KDSTAMM P JOIN VVLIEF ON KDKUNDNR=VVKUNDNRE   WHERE  VVNEUDAT>='" + dwData["DSTART"].ToString() + "' AND VVNEUDAT<='" + dwData["DEND"].ToString() + "' AND VVSTATUS IN (" + dwData["C20"].ToString() + ")"; 
                        break;
                    case -1:
                        or1.CommandText = "SELECT MAX(KDKUNDNR) AS KDKUNDNR FROM KDSTAMM WHERE KDMANDANT=:KDMANDANT";
                        or1.Parameters.Add("KDMANDANT", OracleType.NVarChar).Value = dwData["KDMANDANT"].ToString();
                        break;
                    default:
                        break;
                }
                Result = Connect2Proxy(or1);
                if (Result.Tables.Count > 0)
                {
                    tbLocal = Result.Tables[0];
                    tbLocal.TableName = "KDSTAMM";
                }
                Return.Merge(Result);
            
            return Return;
        }
        public void UpdateKDSTAMM(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            OracleCommand or1;
            DataSet Result = new DataSet();
            or1 = OracleDB.CreateCommand();

            #region====Command====

            or1.CommandText = "UPDATE KDSTAMM SET "
+ "KDMANDANT=:KDMANDANT,"
+ "KDKUNDNR=:KDKUNDNR,"
+ "KDKUNDNA=:KDKUNDNA,"
+ "KDLAND=:KDLAND,"
+ "KDPLZ=:KDPLZ,"
+ "KDORT=:KDORT,"
+ "KDBZ=:KDBZ,"
+ "KDBZBEZ=:KDBZBEZ,"
+ "KDSTAKZ=:KDSTAKZ,"
+ "KDSTADAT=:KDSTADAT,"
+ "KDABCKL=:KDABCKL,"
+ "KDANREDE=:KDANREDE,"
+ "KDNAME1=:KDNAME1,"
+ "KDKNAME=:KDKNAME,"
+ "KDNAME2=:KDNAME2,"
+ "KDSTRASSE1=:KDSTRASSE1,"
+ "KDSTRASSE2=:KDSTRASSE2,"
+ "KDPLZPOSTF=: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DPRFZEUG,"
+ "KDKONZMIT=:KDKONZMIT,"
+ "KDRAITING=:KDRAITING,"
+ "KDRECHWERT1=:KDRECHWERT1,"
+ "KDRECHWERT2=:KDRECHWERT2,"
+ "KDRECHWERT3=:KDRECHWERT3,"
+ "KDRECHWERT4=:KDRECHWERT4,"
+ "KDRECHWERT5=:KDRECHWERT5,"
+ "KDKREDKDNR=:KDKREDKDNR,"
+ "KDKOND=:KDKOND,"
+ "KDKDARTBEZ=:KDKDARTBEZ,"
+ "KDKFIBUDAT=:KDKFIBUDAT,"
+ "KDKFIBUZEIT=:KDKFIBUZEIT,"
+ "KDILN=:KDILN,"
+ "KDDEBNRLAE=:KDDEBNRLAE,"
+ "KDFACLIMIT=:KDFACLIMIT,"
+ "KDSHIPINVD=:KDSHIPINVD,"
+ "KDAUFBUTO=:KDAUFBUTO,"
+ "KDMAXBST=:KDMAXBST,"
+ "KDGRUPPE=:KDGRUPPE,"
+ "KDEORI=:KDEORI,"
+ "KDEORINL=:KDEORINL,"
+ "KDNTSCV=:KDNTSCV,"
+ "KDNTSCE=:KDNTSCE,"
+ "KDFILLER=:KDFILLER,"
+ "KDAENZL=:KDAENZL,"
+ "KDAENB=:KDAENB,"
+ "KDAEND=:KDAEND,"
+ "KDNEUB=:KDNEUB,"
+ "KDNEUD=:KDNEUD "
                + " WHERE  "
                + "  KDMANDANT=:KDMANDANT AND KDKUNDNR=:KDKUNDNR";
            #endregion

            #region====Parameters====
            or1.Parameters.Add("KDMANDANT", OracleType.NVarChar).Value = dwData["KDMANDANT"].ToString();
            or1.Parameters.Add("KDKUNDNR", OracleType.NVarChar).Value = dwData["KDKUNDNR"].ToString();
            or1.Parameters.Add("KDKUNDNA", OracleType.NVarChar).Value = dwData["KDKUNDNA"].ToString();
            or1.Parameters.Add("KDLAND", OracleType.NVarChar).Value = dwData["KDLAND"].ToString();
            or1.Parameters.Add("KDPLZ", OracleType.NVarChar).Value = dwData["KDPLZ"].ToString();
            or1.Parameters.Add("KDORT", OracleType.NVarChar).Value = dwData["KDORT"].ToString();
            or1.Parameters.Add("KDBZ", OracleType.NVarChar).Value = dwData["KDBZ"].ToString();
            or1.Parameters.Add("KDBZBEZ", OracleType.NVarChar).Value = dwData["KDBZBEZ"].ToString();
            or1.Parameters.Add("KDSTAKZ", OracleType.NVarChar).Value = dwData["KDSTAKZ"].ToString();
            or1.Parameters.Add("KDSTADAT", OracleType.NVarChar).Value = dwData["KDSTADAT"].ToString();
            or1.Parameters.Add("KDABCKL", OracleType.NVarChar).Value = dwData["KDABCKL"].ToString();
            or1.Parameters.Add("KDANREDE", OracleType.NVarChar).Value = dwData["KDANREDE"].ToString();
            or1.Parameters.Add("KDNAME1", OracleType.NVarChar).Value = dwData["KDNAME1"].ToString();
            or1.Parameters.Add("KDKNAME", OracleType.NVarChar).Value = dwData["KDKNAME"].ToString();
            or1.Parameters.Add("KDNAME2", OracleType.NVarChar).Value = dwData["KDNAME2"].ToString();
            or1.Parameters.Add("KDSTRASSE1", OracleType.NVarChar).Value = dwData["KDSTRASSE1"].ToString();
            or1.Parameters.Add("KDSTRASSE2", OracleType.NVarChar).Value = dwData["KDSTRASSE2"].ToString();
            or1.Parameters.Add("KDPLZPOSTF", OracleType.NVarChar).Value = dwData["KDPLZPOSTF"].ToString();
            or1.Parameters.Add("KDPOSTFACH", OracleType.NVarChar).Value = dwData["KDPOSTFACH"].ToString();
            or1.Parameters.Add("KDTEL", OracleType.NVarChar).Value = dwData["KDTEL"].ToString();
            or1.Parameters.Add("KDTELEX", OracleType.NVarChar).Value = dwData["KDTELEX"].ToString();
            or1.Parameters.Add("KDFAX", OracleType.NVarChar).Value = dwData["KDFAX"].ToString();
            or1.Parameters.Add("KDBTX", OracleType.NVarChar).Value = dwData["KDBTX"].ToString();
            or1.Parameters.Add("KDDATEX", OracleType.NVarChar).Value = dwData["KDDATEX"].ToString();
            or1.Parameters.Add("KDMBOX", OracleType.NVarChar).Value = dwData["KDMBOX"].ToString();
            or1.Parameters.Add("KDMAILADR", OracleType.NVarChar).Value = dwData["KDMAILADR"].ToString();
            or1.Parameters.Add("KDTTEX", OracleType.NVarChar).Value = dwData["KDTTEX"].ToString();
            or1.Parameters.Add("KDCOUNTY", OracleType.NVarChar).Value = dwData["KDCOUNTY"].ToString();
            or1.Parameters.Add("KDCITY", OracleType.NVarChar).Value = dwData["KDCITY"].ToString();
            or1.Parameters.Add("KDZENTR", OracleType.NVarChar).Value = dwData["KDZENTR"].ToString();
            or1.Parameters.Add("KDZENTRR", OracleType.NVarChar).Value = dwData["KDZENTRR"].ToString();
            or1.Parameters.Add("KDSPRKZ", OracleType.NVarChar).Value = dwData["KDSPRKZ"].ToString();
            or1.Parameters.Add("KDBBN", OracleType.NVarChar).Value = dwData["KDBBN"].ToString();
            or1.Parameters.Add("KDSONDSTA", OracleType.NVarChar).Value = dwData["KDSONDSTA"].ToString();
            or1.Parameters.Add("KDKDNRALT", OracleType.NVarChar).Value = dwData["KDKDNRALT"].ToString();
            or1.Parameters.Add("KDLO", OracleType.NVarChar).Value = dwData["KDLO"].ToString();
            or1.Parameters.Add("KDLB", OracleType.NVarChar).Value = dwData["KDLB"].ToString();
            or1.Parameters.Add("KDLP", OracleType.NVarChar).Value = dwData["KDLP"].ToString();
            or1.Parameters.Add("KDLIEFNR", OracleType.NVarChar).Value = dwData["KDLIEFNR"].ToString();
            or1.Parameters.Add("KDINVDAT", OracleType.NVarChar).Value = dwData["KDINVDAT"].ToString();
            or1.Parameters.Add("KDDEBNR", OracleType.NVarChar).Value = dwData["KDDEBNR"].ToString();
            or1.Parameters.Add("KDKREDNR", OracleType.NVarChar).Value = dwData["KDKREDNR"].ToString();
            or1.Parameters.Add("KDUEBKZ", OracleType.NVarChar).Value = dwData["KDUEBKZ"].ToString();
            or1.Parameters.Add("KDAUSK", OracleType.NVarChar).Value = dwData["KDAUSK"].ToString();
            or1.Parameters.Add("KDAUSKKZ", OracleType.NVarChar).Value = dwData["KDAUSKKZ"].ToString();
            or1.Parameters.Add("KDMAHNST", OracleType.NVarChar).Value = dwData["KDMAHNST"].ToString();
            or1.Parameters.Add("KDMAHNH", OracleType.NVarChar).Value = dwData["KDMAHNH"].ToString();
            or1.Parameters.Add("KDGRPCUNO", OracleType.NVarChar).Value = dwData["KDGRPCUNO"].ToString();
            or1.Parameters.Add("KDCLEARCUNO", OracleType.NVarChar).Value = dwData["KDCLEARCUNO"].ToString();
            or1.Parameters.Add("KDBIC1", OracleType.NVarChar).Value = dwData["KDBIC1"].ToString();
            or1.Parameters.Add("KDIBAN1", OracleType.NVarChar).Value = dwData["KDIBAN1"].ToString();
            or1.Parameters.Add("KDBIC2", OracleType.NVarChar).Value = dwData["KDBIC2"].ToString();
            or1.Parameters.Add("KDIBAN2", OracleType.NVarChar).Value = dwData["KDIBAN2"].ToString();
            or1.Parameters.Add("KDKREDLIM1", OracleType.NVarChar).Value = dwData["KDKREDLIM1"].ToString();
            or1.Parameters.Add("KDKREDVON1", OracleType.NVarChar).Value = dwData["KDKREDVON1"].ToString();
            or1.Parameters.Add("KDKREDBIS1", OracleType.NVarChar).Value = dwData["KDKREDBIS1"].ToString();
            or1.Parameters.Add("KDKREDNLDAT1", OracleType.NVarChar).Value = dwData["KDKREDNLDAT1"].ToString();
            or1.Parameters.Add("KDVERS1", OracleType.NVarChar).Value = dwData["KDVERS1"].ToString();
            or1.Parameters.Add("KDVERS21", OracleType.NVarChar).Value = dwData["KDVERS21"].ToString();
            or1.Parameters.Add("KDKREDSB1", OracleType.NVarChar).Value = dwData["KDKREDSB1"].ToString();
            or1.Parameters.Add("KDVERSTAGE1", OracleType.NVarChar).Value = dwData["KDVERSTAGE1"].ToString();
            or1.Parameters.Add("KDVERSNR1", OracleType.NVarChar).Value = dwData["KDVERSNR1"].ToString();
            or1.Parameters.Add("KDKREDLIM2", OracleType.NVarChar).Value = dwData["KDKREDLIM2"].ToString();
            or1.Parameters.Add("KDKREDVON2", OracleType.NVarChar).Value = dwData["KDKREDVON2"].ToString();
            or1.Parameters.Add("KDKREDBIS2", OracleType.NVarChar).Value = dwData["KDKREDBIS2"].ToString();
            or1.Parameters.Add("KDKREDNLDAT2", OracleType.NVarChar).Value = dwData["KDKREDNLDAT2"].ToString();
            or1.Parameters.Add("KDVERS2", OracleType.NVarChar).Value = dwData["KDVERS2"].ToString();
            or1.Parameters.Add("KDVERS22", OracleType.NVarChar).Value = dwData["KDVERS22"].ToString();
            or1.Parameters.Add("KDKREDSB2", OracleType.NVarChar).Value = dwData["KDKREDSB2"].ToString();
            or1.Parameters.Add("KDVERSTAGE2", OracleType.NVarChar).Value = dwData["KDVERSTAGE2"].ToString();
            or1.Parameters.Add("KDVERSNR2", OracleType.NVarChar).Value = dwData["KDVERSNR2"].ToString();
            or1.Parameters.Add("KDKREDLIM3", OracleType.NVarChar).Value = dwData["KDKREDLIM3"].ToString();
            or1.Parameters.Add("KDKREDVON3", OracleType.NVarChar).Value = dwData["KDKREDVON3"].ToString();
            or1.Parameters.Add("KDKREDBIS3", OracleType.NVarChar).Value = dwData["KDKREDBIS3"].ToString();
            or1.Parameters.Add("KDKREDNLDAT3", OracleType.NVarChar).Value = dwData["KDKREDNLDAT3"].ToString();
            or1.Parameters.Add("KDVERS3", OracleType.NVarChar).Value = dwData["KDVERS3"].ToString();
            or1.Parameters.Add("KDVERS23", OracleType.NVarChar).Value = dwData["KDVERS23"].ToString();
            or1.Parameters.Add("KDKREDSB3", OracleType.NVarChar).Value = dwData["KDKREDSB3"].ToString();
            or1.Parameters.Add("KDVERSTAGE3", OracleType.NVarChar).Value = dwData["KDVERSTAGE3"].ToString();
            or1.Parameters.Add("KDVERSNR3", OracleType.NVarChar).Value = dwData["KDVERSNR3"].ToString();
            or1.Parameters.Add("KDKREDLIM4", OracleType.NVarChar).Value = dwData["KDKREDLIM4"].ToString();
            or1.Parameters.Add("KDKREDVON4", OracleType.NVarChar).Value = dwData["KDKREDVON4"].ToString();
            or1.Parameters.Add("KDKREDBIS4", OracleType.NVarChar).Value = dwData["KDKREDBIS4"].ToString();
            or1.Parameters.Add("KDKREDNLDAT4", OracleType.NVarChar).Value = dwData["KDKREDNLDAT4"].ToString();
            or1.Parameters.Add("KDVERS4", OracleType.NVarChar).Value = dwData["KDVERS4"].ToString();
            or1.Parameters.Add("KDVERS24", OracleType.NVarChar).Value = dwData["KDVERS24"].ToString();
            or1.Parameters.Add("KDKREDSB4", OracleType.NVarChar).Value = dwData["KDKREDSB4"].ToString();
            or1.Parameters.Add("KDVERSTAGE4", OracleType.NVarChar).Value = dwData["KDVERSTAGE4"].ToString();
            or1.Parameters.Add("KDVERSNR4", OracleType.NVarChar).Value = dwData["KDVERSNR4"].ToString();
            or1.Parameters.Add("KDKREDLIM5", OracleType.NVarChar).Value = dwData["KDKREDLIM5"].ToString();
            or1.Parameters.Add("KDKREDVON5", OracleType.NVarChar).Value = dwData["KDKREDVON5"].ToString();
            or1.Parameters.Add("KDKREDBIS5", OracleType.NVarChar).Value = dwData["KDKREDBIS5"].ToString();
            or1.Parameters.Add("KDKREDNLDAT5", OracleType.NVarChar).Value = dwData["KDKREDNLDAT5"].ToString();
            or1.Parameters.Add("KDVERS5", OracleType.NVarChar).Value = dwData["KDVERS5"].ToString();
            or1.Parameters.Add("KDVERS25", OracleType.NVarChar).Value = dwData["KDVERS25"].ToString();
            or1.Parameters.Add("KDKREDSB5", OracleType.NVarChar).Value = dwData["KDKREDSB5"].ToString();
            or1.Parameters.Add("KDVERSTAGE5", OracleType.NVarChar).Value = dwData["KDVERSTAGE5"].ToString();
            or1.Parameters.Add("KDVERSNR5", OracleType.NVarChar).Value = dwData["KDVERSNR5"].ToString();
            or1.Parameters.Add("KDKREDEHA", OracleType.NVarChar).Value = dwData["KDKREDEHA"].ToString();
            or1.Parameters.Add("KDKREDEHAR", OracleType.NVarChar).Value = dwData["KDKREDEHAR"].ToString();
            or1.Parameters.Add("KDKREDNOLI", OracleType.NVarChar).Value = dwData["KDKREDNOLI"].ToString();
            or1.Parameters.Add("KDKREDNOLIV", OracleType.NVarChar).Value = dwData["KDKREDNOLIV"].ToString();
            or1.Parameters.Add("KDKREDNOLIB", OracleType.NVarChar).Value = dwData["KDKREDNOLIB"].ToString();
            or1.Parameters.Add("KDAUFBESTTO", OracleType.NVarChar).Value = dwData["KDAUFBESTTO"].ToString();
            or1.Parameters.Add("KDVERSUMLTO", OracleType.NVarChar).Value = dwData["KDVERSUMLTO"].ToString();
            or1.Parameters.Add("KDOPSALDOTO", OracleType.NVarChar).Value = dwData["KDOPSALDOTO"].ToString();
            or1.Parameters.Add("KDZUSKRED", OracleType.NVarChar).Value = dwData["KDZUSKRED"].ToString();
            or1.Parameters.Add("KDZKREVON", OracleType.NVarChar).Value = dwData["KDZKREVON"].ToString();
            or1.Parameters.Add("KDZKREBIS", OracleType.NVarChar).Value = dwData["KDZKREBIS"].ToString();
            or1.Parameters.Add("KDZKREDSB", OracleType.NVarChar).Value = dwData["KDZKREDSB"].ToString();
            or1.Parameters.Add("KDOPSALDO", OracleType.NVarChar).Value = dwData["KDOPSALDO"].ToString();
            or1.Parameters.Add("KDWEOBLIGO", OracleType.NVarChar).Value = dwData["KDWEOBLIGO"].ToString();
            or1.Parameters.Add("KDVERSUML", OracleType.NVarChar).Value = dwData["KDVERSUML"].ToString();
            or1.Parameters.Add("KDSPERRKZ", OracleType.NVarChar).Value = dwData["KDSPERRKZ"].ToString();
            or1.Parameters.Add("KDSPERRGRD", OracleType.NVarChar).Value = dwData["KDSPERRGRD"].ToString();
            or1.Parameters.Add("KDLAUFDAT", OracleType.NVarChar).Value = dwData["KDLAUFDAT"].ToString();
            or1.Parameters.Add("KDBUCHHDAT", OracleType.NVarChar).Value = dwData["KDBUCHHDAT"].ToString();
            or1.Parameters.Add("KDBRANCHE", OracleType.NVarChar).Value = dwData["KDBRANCHE"].ToString();
            or1.Parameters.Add("KDFAKTART", OracleType.NVarChar).Value = dwData["KDFAKTART"].ToString();
            or1.Parameters.Add("KDKORT", OracleType.NVarChar).Value = dwData["KDKORT"].ToString();
            or1.Parameters.Add("KDLIMITKZ", OracleType.NVarChar).Value = dwData["KDLIMITKZ"].ToString();
            or1.Parameters.Add("KDSPLIEFKZ", OracleType.NVarChar).Value = dwData["KDSPLIEFKZ"].ToString();
            or1.Parameters.Add("KDAUFBEST", OracleType.NVarChar).Value = dwData["KDAUFBEST"].ToString();
            or1.Parameters.Add("KDAUFBESTU", OracleType.NVarChar).Value = dwData["KDAUFBESTU"].ToString();
            or1.Parameters.Add("KDPREISPRF", OracleType.NVarChar).Value = dwData["KDPREISPRF"].ToString();
            or1.Parameters.Add("KDMATPRF", OracleType.NVarChar).Value = dwData["KDMATPRF"].ToString();
            or1.Parameters.Add("KDBRTPRF", OracleType.NVarChar).Value = dwData["KDBRTPRF"].ToString();
            or1.Parameters.Add("KDGQMPRF", OracleType.NVarChar).Value = dwData["KDGQMPRF"].ToString();
            or1.Parameters.Add("KDSTKGPRF", OracleType.NVarChar).Value = dwData["KDSTKGPRF"].ToString();
            or1.Parameters.Add("KDSCHLIPRF", OracleType.NVarChar).Value = dwData["KDSCHLIPRF"].ToString();
            or1.Parameters.Add("KDSCHLIABW", OracleType.NVarChar).Value = dwData["KDSCHLIABW"].ToString();
            or1.Parameters.Add("KDDRPAR", OracleType.NVarChar).Value = dwData["KDDRPAR"].ToString();
            or1.Parameters.Add("KDMWSTID", OracleType.NVarChar).Value = dwData["KDMWSTID"].ToString();
            or1.Parameters.Add("KDMWSTID2", OracleType.NVarChar).Value = dwData["KDMWSTID2"].ToString();
            or1.Parameters.Add("KDLBMUSTR", OracleType.NVarChar).Value = dwData["KDLBMUSTR"].ToString();
            or1.Parameters.Add("KDFBMUSTR", OracleType.NVarChar).Value = dwData["KDFBMUSTR"].ToString();
            or1.Parameters.Add("KDSTLAND", OracleType.NVarChar).Value = dwData["KDSTLAND"].ToString();
            or1.Parameters.Add("KDSTREGBZ", OracleType.NVarChar).Value = dwData["KDSTREGBZ"].ToString();
            or1.Parameters.Add("KDSTKREIS", OracleType.NVarChar).Value = dwData["KDSTKREIS"].ToString();
            or1.Parameters.Add("KDSTORT", OracleType.NVarChar).Value = dwData["KDSTORT"].ToString();
            or1.Parameters.Add("KDLSART", OracleType.NVarChar).Value = dwData["KDLSART"].ToString();
            or1.Parameters.Add("KDREGMWST", OracleType.NVarChar).Value = dwData["KDREGMWST"].ToString();
            or1.Parameters.Add("KDMUSTERKZ", OracleType.NVarChar).Value = dwData["KDMUSTERKZ"].ToString();
            or1.Parameters.Add("KDUMSVVJH", OracleType.NVarChar).Value = dwData["KDUMSVVJH"].ToString();
            or1.Parameters.Add("KDUMSVJH", OracleType.NVarChar).Value = dwData["KDUMSVJH"].ToString();
            or1.Parameters.Add("KDUMSLJH", OracleType.NVarChar).Value = dwData["KDUMSLJH"].ToString();
            or1.Parameters.Add("KDPRFZEUG", OracleType.NVarChar).Value = dwData["KDPRFZEUG"].ToString();
            or1.Parameters.Add("KDKONZMIT", OracleType.NVarChar).Value = dwData["KDKONZMIT"].ToString();
            or1.Parameters.Add("KDRAITING", OracleType.NVarChar).Value = dwData["KDRAITING"].ToString();
            or1.Parameters.Add("KDRECHWERT1", OracleType.NVarChar).Value = dwData["KDRECHWERT1"].ToString();
            or1.Parameters.Add("KDRECHWERT2", OracleType.NVarChar).Value = dwData["KDRECHWERT2"].ToString();
            or1.Parameters.Add("KDRECHWERT3", OracleType.NVarChar).Value = dwData["KDRECHWERT3"].ToString();
            or1.Parameters.Add("KDRECHWERT4", OracleType.NVarChar).Value = dwData["KDRECHWERT4"].ToString();
            or1.Parameters.Add("KDRECHWERT5", OracleType.NVarChar).Value = dwData["KDRECHWERT5"].ToString();
            or1.Parameters.Add("KDKREDKDNR", OracleType.NVarChar).Value = dwData["KDKREDKDNR"].ToString();
            or1.Parameters.Add("KDKOND", OracleType.NVarChar).Value = dwData["KDKOND"].ToString();
            or1.Parameters.Add("KDKDARTBEZ", OracleType.NVarChar).Value = dwData["KDKDARTBEZ"].ToString();
            or1.Parameters.Add("KDKFIBUDAT", OracleType.NVarChar).Value = dwData["KDKFIBUDAT"].ToString();
            or1.Parameters.Add("KDKFIBUZEIT", OracleType.NVarChar).Value = dwData["KDKFIBUZEIT"].ToString();
            or1.Parameters.Add("KDILN", OracleType.NVarChar).Value = dwData["KDILN"].ToString();
            or1.Parameters.Add("KDDEBNRLAE", OracleType.NVarChar).Value = dwData["KDDEBNRLAE"].ToString();
            or1.Parameters.Add("KDFACLIMIT", OracleType.NVarChar).Value = dwData["KDFACLIMIT"].ToString();
            or1.Parameters.Add("KDSHIPINVD", OracleType.NVarChar).Value = dwData["KDSHIPINVD"].ToString();
            or1.Parameters.Add("KDAUFBUTO", OracleType.NVarChar).Value = dwData["KDAUFBUTO"].ToString();
            or1.Parameters.Add("KDMAXBST", OracleType.NVarChar).Value = dwData["KDMAXBST"].ToString();
            or1.Parameters.Add("KDGRUPPE", OracleType.NVarChar).Value = dwData["KDGRUPPE"].ToString();
            or1.Parameters.Add("KDEORI", OracleType.NVarChar).Value = dwData["KDEORI"].ToString();
            or1.Parameters.Add("KDEORINL", OracleType.NVarChar).Value = dwData["KDEORINL"].ToString();
            or1.Parameters.Add("KDNTSCV", OracleType.NVarChar).Value = dwData["KDNTSCV"].ToString();
            or1.Parameters.Add("KDNTSCE", OracleType.NVarChar).Value = dwData["KDNTSCE"].ToString();
            or1.Parameters.Add("KDFILLER", OracleType.NVarChar).Value = dwData["KDFILLER"].ToString();
            or1.Parameters.Add("KDAENZL", OracleType.NVarChar).Value = dwData["KDAENZL"].ToString();
            or1.Parameters.Add("KDAENB", OracleType.NVarChar).Value = dwData["KDAENB"].ToString();
            or1.Parameters.Add("KDAEND", OracleType.NVarChar).Value = dwData["KDAEND"].ToString();
            or1.Parameters.Add("KDNEUB", OracleType.NVarChar).Value = dwData["KDNEUB"].ToString();
            or1.Parameters.Add("KDNEUD", OracleType.NVarChar).Value = dwData["KDNEUD"].ToString();
            #endregion

            Connect2Proxy(or1);
        }
    }
}
